package com.roadmap.entities;

import java.util.Date;

import com.roadmap.common.BaseEntity;

public class Execution extends BaseEntity {
	private String taskId;
	private String content;
	private Date executeDate;
	private int executeTimeLength;
	private int proportionOfTask;

	public Execution() {
		this.executeTimeLength = 1;
		this.proportionOfTask = 100;
		this.executeDate = new Date();
	}

	public Execution(String taskId, String content, Date executeDate, int executeTimeLength,
			int proportionOfTask) {
		this.taskId = taskId;
		this.content = content;
		this.executeDate = executeDate;
		this.executeTimeLength = executeTimeLength;
		this.proportionOfTask = proportionOfTask;
	}

	public Execution(String id, Date createdTime, Date updatedTime, String taskId, String content,
			Date executeDate, int executeTimeLength, int proportionOfTask) {
		super(id, createdTime, updatedTime);
		this.taskId = taskId;
		this.content = content;
		this.executeDate = executeDate;
		this.executeTimeLength = executeTimeLength;
		this.proportionOfTask = proportionOfTask;
	}

	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getExecuteDate() {
		return executeDate;
	}

	public void setExecuteDate(Date executeDate) {
		this.executeDate = executeDate;
	}

	public int getExecuteTimeLength() {
		return executeTimeLength;
	}

	public void setExecuteTimeLength(int executeTimeLength) {
		this.executeTimeLength = executeTimeLength;
	}

	public int getProportionOfTask() {
		return proportionOfTask;
	}

	public void setProportionOfTask(int proportionOfTask) {
		this.proportionOfTask = proportionOfTask;
	}

	@Override
	public String getWhatItIs() {
		if (getContent() != null && getContent().length() > DESP_MAX_LENGTH) {
			return getContent().substring(0, DESP_MAX_LENGTH) + "...";
		}
		return getContent();
	}
}
